{ "cells": [ { "cell_type": "markdown", "id": "8ea9f424-c378-4acb-8e0a-979e8d039c10", "metadata": {}, "source": [ "# Exploring a Group of Variables\n", "\n", "There are thousands of different variables avaialble via the US Census\n", "API. One way to navigate through them is to look through a hierarchy\n", "of web pages starting with a year, like 2020, on a page like \n", "https://api.census.gov/data/2020.html. \n", "\n", "From here we can navigate down\n", "to a particular data source, by following the link \n", "in the *Group List* column of the first row, which is for the dataset\n", "`acs/acs5`. This takes us to \n", "https://api.census.gov/data/2020/acs/acs5/groups.html. \n", "\n", "From there,\n", "we can choose the group named B03002, which takes us to \n", "https://api.census.gov/data/2020/acs/acs5/groups/B03002.html, where we \n", "can see all the variables in the group. \n", "\n", "Some of these variables are estimates,\n", "and some of them are annotations. Normally, we are interested in the estimates.\n", "\n", "Every variable has a label, which is a string of components seperated by\n", "!!. For example, B03002_007E has the label, \n", "\"Estimate!!Total:!!Not Hispanic or Latino:!!Native Hawaiian and Other Pacific Islander alone\".\n", "The !! seperators imply a tree among the variables, from the root all the way down\n", "to leaves. Internal nodes in the tree represent variables that are aggregates of \n", "those lower than them in the tree. For example, B03002_002E is the size of the \n", "population that is not Hispanic or Latino, regardless of race. It is the sum of\n", "B03002_003E, B03002_004E, B03002_005E, B03002_006E, B03002_007E, B03002_008E, and B03002_009E,\n", "which count people of different races who are not Hispanic or Latino. All of these\n", "are leaves of the tree, except B03002_009E, which is further subdivided into\n", "B03002_010E and B03002_011E.\n", "\n", "All of this can get really confusing when you look at it in the tabular form\n", "on the web page. In order to make it less confusing, the `censusdis` package\n", "includes code to fetch and present the variable hierarchy in a more understandable\n", "way. That's what the remainder of this notebook is about." ] }, { "cell_type": "markdown", "id": "64eb8577-e145-4a74-be7b-bff9798945eb", "metadata": {}, "source": [ "## Import and Configuration" ] }, { "cell_type": "code", "execution_count": 1, "id": "f047c3d9-1313-4a5b-93d5-a63cb0143feb", "metadata": {}, "outputs": [], "source": [ "import censusdis.data as ced\n", "import censusdis.geography as cgeo\n", "from censusdis.states import STATE_NJ" ] }, { "cell_type": "code", "execution_count": 2, "id": "0da51fff-7082-4ee0-be2c-f6b5b6dfface", "metadata": {}, "outputs": [], "source": [ "YEAR = 2020\n", "DATASET = \"acs/acs5\"\n", "GROUP = \"B03002\"" ] }, { "cell_type": "markdown", "id": "aa789c6e-1f91-4d0f-9f03-56bf9151f484", "metadata": {}, "source": [ "## Programmatic Access to a Group Variable Tree\n", "\n", "We can get the whole collection of variables in tree form and print it.\n", "This format makes it easier to see the relationships we saw in the\n", "table at https://api.census.gov/data/2020/acs/acs5/groups/B03002.html.\n", "\n", "We can see clearly where variables exist at internal nodes of the tree\n", "and where they exist at the leaves. Not all internal nodes have variables\n", "but all leaves do." ] }, { "cell_type": "code", "execution_count": 3, "id": "b0429d06-d3f9-4eb3-83a5-7c653b1dd7f2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+ Estimate\n", " + Total: (B03002_001E)\n", " + Not Hispanic or Latino: (B03002_002E)\n", " + White alone (B03002_003E)\n", " + Black or African American alone (B03002_004E)\n", " + American Indian and Alaska Native alone (B03002_005E)\n", " + Asian alone (B03002_006E)\n", " + Native Hawaiian and Other Pacific Islander alone (B03002_007E)\n", " + Some other race alone (B03002_008E)\n", " + Two or more races: (B03002_009E)\n", " + Two races including Some other race (B03002_010E)\n", " + Two races excluding Some other race, and three or more races (B03002_011E)\n", " + Hispanic or Latino: (B03002_012E)\n", " + White alone (B03002_013E)\n", " + Black or African American alone (B03002_014E)\n", " + American Indian and Alaska Native alone (B03002_015E)\n", " + Asian alone (B03002_016E)\n", " + Native Hawaiian and Other Pacific Islander alone (B03002_017E)\n", " + Some other race alone (B03002_018E)\n", " + Two or more races: (B03002_019E)\n", " + Two races including Some other race (B03002_020E)\n", " + Two races excluding Some other race, and three or more races (B03002_021E)\n", "+ Geography (GEO_ID)\n", "+ Geographic Area Name (NAME)\n" ] } ], "source": [ "tree = ced.variables.group_tree(DATASET, YEAR, GROUP)\n", "print(tree)" ] }, { "cell_type": "markdown", "id": "c0bf6115-7c78-479b-b9da-768d921d29dd", "metadata": {}, "source": [ "### Accessing a Sub-Tree\n", "\n", "Most of the time we are only interested in variables that are estimates, so \n", "we can look down in that part of the tree alone." ] }, { "cell_type": "code", "execution_count": 4, "id": "0215cab8-58e1-493a-a606-4bd89f23a0cc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+ Total: (B03002_001E)\n", " + Not Hispanic or Latino: (B03002_002E)\n", " + White alone (B03002_003E)\n", " + Black or African American alone (B03002_004E)\n", " + American Indian and Alaska Native alone (B03002_005E)\n", " + Asian alone (B03002_006E)\n", " + Native Hawaiian and Other Pacific Islander alone (B03002_007E)\n", " + Some other race alone (B03002_008E)\n", " + Two or more races: (B03002_009E)\n", " + Two races including Some other race (B03002_010E)\n", " + Two races excluding Some other race, and three or more races (B03002_011E)\n", " + Hispanic or Latino: (B03002_012E)\n", " + White alone (B03002_013E)\n", " + Black or African American alone (B03002_014E)\n", " + American Indian and Alaska Native alone (B03002_015E)\n", " + Asian alone (B03002_016E)\n", " + Native Hawaiian and Other Pacific Islander alone (B03002_017E)\n", " + Some other race alone (B03002_018E)\n", " + Two or more races: (B03002_019E)\n", " + Two races including Some other race (B03002_020E)\n", " + Two races excluding Some other race, and three or more races (B03002_021E)\n" ] } ], "source": [ "print(tree[\"Estimate\"])" ] }, { "cell_type": "markdown", "id": "c902b36d-4778-4f03-a51e-4a807b33906b", "metadata": {}, "source": [ "### Leaves\n", "\n", "In many cases, we are really just interested in the leaves, because the\n", "internal nodes of the tree contain variables that are aggregate sums of the \n", "subtrees below them." ] }, { "cell_type": "code", "execution_count": 5, "id": "90e6ba8c-404d-4d50-abf6-6526d00c4c69", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['B03002_003E',\n", " 'B03002_004E',\n", " 'B03002_005E',\n", " 'B03002_006E',\n", " 'B03002_007E',\n", " 'B03002_008E',\n", " 'B03002_010E',\n", " 'B03002_011E',\n", " 'B03002_013E',\n", " 'B03002_014E',\n", " 'B03002_015E',\n", " 'B03002_016E',\n", " 'B03002_017E',\n", " 'B03002_018E',\n", " 'B03002_020E',\n", " 'B03002_021E',\n", " 'GEO_ID',\n", " 'NAME']" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "leaves = ced.variables.group_leaves(DATASET, YEAR, GROUP)\n", "leaves" ] }, { "cell_type": "markdown", "id": "89782e3c-b0cb-4f9d-8282-dc631b6e8f19", "metadata": {}, "source": [ "Notice that the set of leaves we got does not include those for\n", "annotations. If we really want to see those too, we can add an\n", "optional argument." ] }, { "cell_type": "code", "execution_count": 6, "id": "baa2920d-4de7-4053-92e0-0b246986d3b9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['B03002_003E',\n", " 'B03002_004E',\n", " 'B03002_005E',\n", " 'B03002_006E',\n", " 'B03002_007E',\n", " 'B03002_008E',\n", " 'B03002_010E',\n", " 'B03002_011E',\n", " 'B03002_013E',\n", " 'B03002_014E',\n", " 'B03002_015E',\n", " 'B03002_016E',\n", " 'B03002_017E',\n", " 'B03002_018E',\n", " 'B03002_020E',\n", " 'B03002_021E',\n", " 'GEO_ID',\n", " 'NAME']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_leaves = ced.variables.group_leaves(DATASET, YEAR, GROUP, skip_annotations=False)\n", "all_leaves" ] }, { "cell_type": "markdown", "id": "d0bfbe81-254e-437d-b54e-5d5fb16ad62b", "metadata": {}, "source": [ "## Programmatic Access to Geographic Hierarchies\n", "\n", "It's great to know the variables that are available, but in order to make full\n", "use of the US Census API and the `censusdis` API around it, we have to know \n", "something about the geography hierarchies that are avaialble for each dataset \n", "in each year it is available. These are available on web pages like \n", "https://api.census.gov/data/2020/acs/acs5/geography.html, which contains a table\n", "of the geographies supported by the ACS5 dataset we have been looking at\n", "for the year 2020.\n", "\n", "But again, we'd prefer to have access to this information in a pythonic way.\n", "The most common way to get this is by calling `censusdis.geography.geo_path_py_specs` \n", "as shown below. This gives us the available hierarchies using Python-friendly\n", "snake-case names that we can use to download data.\n", "\n", "Each item in the dictionary has a key that represents the geography hierarchy and\n", "a value that is the list of the components of the hierachy in snake-case as it can\n", "be passed as an argument to `censusdis.data.download`." ] }, { "cell_type": "code", "execution_count": 7, "id": "4a3b2170-1ff7-4a68-89c4-5c426896de7b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'010': ['us'],\n", " '020': ['region'],\n", " '030': ['division'],\n", " '040': ['state'],\n", " '050': ['state', 'county'],\n", " '060': ['state', 'county', 'county_subdivision'],\n", " '067': ['state', 'county', 'county_subdivision', 'subminor_civil_division'],\n", " '070': ['state', 'county', 'county_subdivision', 'place_remainder_or_part'],\n", " '140': ['state', 'county', 'tract'],\n", " '150': ['state', 'county', 'tract', 'block_group'],\n", " '155': ['state', 'place', 'county_or_part'],\n", " '160': ['state', 'place'],\n", " '170': ['state', 'consolidated_city'],\n", " '172': ['state', 'consolidated_city', 'place_or_part'],\n", " '230': ['state', 'alaska_native_regional_corporation'],\n", " '250': ['american_indian_area_alaska_native_area_hawaiian_home_land'],\n", " '251': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'tribal_subdivision_remainder'],\n", " '252': ['american_indian_area_alaska_native_area_reservation_or_statistical_entity_only'],\n", " '254': ['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land'],\n", " '256': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'tribal_census_tract'],\n", " '258': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'tribal_census_tract',\n", " 'tribal_block_group'],\n", " '260': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'state_or_part'],\n", " '269': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'state_or_part',\n", " 'place_remainder_or_part'],\n", " '270': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'state_or_part',\n", " 'county_or_part'],\n", " '280': ['state',\n", " 'american_indian_area_alaska_native_area_hawaiian_home_land_or_part'],\n", " '283': ['state',\n", " 'american_indian_area_alaska_native_area_reservation_or_statistical_entity_only_or_part'],\n", " '286': ['state',\n", " 'american_indian_area_off_reservation_trust_land_only_hawaiian_home_land_or_part'],\n", " '290': ['american_indian_area_alaska_native_area_hawaiian_home_land',\n", " 'tribal_subdivision_remainder',\n", " 'state_or_part'],\n", " '291': ['american_indian_area_reservation_only',\n", " 'tribal_census_tract_or_part'],\n", " '292': ['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land',\n", " 'tribal_census_tract_or_part'],\n", " '293': ['american_indian_area_reservation_only',\n", " 'tribal_census_tract_or_part',\n", " 'tribal_block_group_or_part'],\n", " '294': ['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land',\n", " 'tribal_census_tract_or_part',\n", " 'tribal_block_group_or_part'],\n", " '310': ['metropolitan_statistical_area_micropolitan_statistical_area'],\n", " '311': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'state_or_part'],\n", " '312': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'state_or_part',\n", " 'principal_city_or_part'],\n", " '313': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'state_or_part',\n", " 'county'],\n", " '314': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'metropolitan_division'],\n", " '315': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'metropolitan_division',\n", " 'state_or_part'],\n", " '316': ['metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'metropolitan_division',\n", " 'state_or_part',\n", " 'county'],\n", " '320': ['state',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part'],\n", " '321': ['state',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part',\n", " 'principal_city_or_part'],\n", " '322': ['state',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part',\n", " 'county'],\n", " '323': ['state',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part',\n", " 'metropolitan_division_or_part'],\n", " '324': ['state',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part',\n", " 'metropolitan_division_or_part',\n", " 'county'],\n", " '330': ['combined_statistical_area'],\n", " '331': ['combined_statistical_area', 'state_or_part'],\n", " '332': ['combined_statistical_area',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area'],\n", " '333': ['combined_statistical_area',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area',\n", " 'state_or_part'],\n", " '335': ['combined_new_england_city_and_town_area'],\n", " '336': ['combined_new_england_city_and_town_area', 'state_or_part'],\n", " '337': ['combined_new_england_city_and_town_area',\n", " 'new_england_city_and_town_area'],\n", " '338': ['combined_new_england_city_and_town_area',\n", " 'new_england_city_and_town_area',\n", " 'state_or_part'],\n", " '340': ['state', 'combined_statistical_area_or_part'],\n", " '341': ['state',\n", " 'combined_statistical_area_or_part',\n", " 'metropolitan_statistical_area_micropolitan_statistical_area_or_part'],\n", " '345': ['state', 'combined_new_england_city_and_town_area_or_part'],\n", " '346': ['state',\n", " 'combined_new_england_city_and_town_area_or_part',\n", " 'new_england_city_and_town_area_or_part'],\n", " '350': ['new_england_city_and_town_area'],\n", " '351': ['new_england_city_and_town_area', 'state_or_part'],\n", " '352': ['new_england_city_and_town_area', 'state_or_part', 'principal_city'],\n", " '353': ['new_england_city_and_town_area', 'state_or_part', 'county_or_part'],\n", " '354': ['new_england_city_and_town_area',\n", " 'state_or_part',\n", " 'county_or_part',\n", " 'county_subdivision'],\n", " '355': ['new_england_city_and_town_area', 'necta_division'],\n", " '356': ['new_england_city_and_town_area', 'necta_division', 'state_or_part'],\n", " '357': ['new_england_city_and_town_area',\n", " 'necta_division',\n", " 'state_or_part',\n", " 'county_or_part'],\n", " '358': ['new_england_city_and_town_area',\n", " 'necta_division',\n", " 'state_or_part',\n", " 'county_or_part',\n", " 'county_subdivision'],\n", " '360': ['state', 'new_england_city_and_town_area_or_part'],\n", " '361': ['state', 'new_england_city_and_town_area_or_part', 'principal_city'],\n", " '362': ['state', 'new_england_city_and_town_area_or_part', 'county_or_part'],\n", " '363': ['state',\n", " 'new_england_city_and_town_area_or_part',\n", " 'county_or_part',\n", " 'county_subdivision'],\n", " '364': ['state',\n", " 'new_england_city_and_town_area_or_part',\n", " 'necta_division_or_part'],\n", " '365': ['state',\n", " 'new_england_city_and_town_area_or_part',\n", " 'necta_division_or_part',\n", " 'county_or_part'],\n", " '366': ['state',\n", " 'new_england_city_and_town_area_or_part',\n", " 'necta_division_or_part',\n", " 'county_or_part',\n", " 'county_subdivision'],\n", " '400': ['urban_area'],\n", " '410': ['urban_area', 'state'],\n", " '430': ['urban_area', 'state', 'county'],\n", " '500': ['state', 'congressional_district'],\n", " '510': ['state', 'congressional_district', 'county_or_part'],\n", " '550': ['state',\n", " 'congressional_district',\n", " 'american_indian_area_alaska_native_area_hawaiian_home_land_or_part'],\n", " '610': ['state', 'state_legislative_district_upper_chamber'],\n", " '612': ['state',\n", " 'state_legislative_district_upper_chamber',\n", " 'county_or_part'],\n", " '620': ['state', 'state_legislative_district_lower_chamber'],\n", " '622': ['state',\n", " 'state_legislative_district_lower_chamber',\n", " 'county_or_part'],\n", " '795': ['state', 'public_use_microdata_area'],\n", " '860': ['zip_code_tabulation_area'],\n", " '950': ['state', 'school_district_elementary'],\n", " '960': ['state', 'school_district_secondary'],\n", " '970': ['state', 'school_district_unified']}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cgeo.geo_path_snake_specs(DATASET, YEAR)" ] }, { "cell_type": "markdown", "id": "f322420c-7af5-4548-ab68-3cfb075c9ea8", "metadata": {}, "source": [ "## Loading Data for Leaves\n", "\n", "Once we know the variables we want, for example the leaves of group B03002 that we found\n", "above, and we select one of the geogpraphy types and fill in the particular values we want\n", "at each level, we can load data for them. In our case, we will use the one with the key `'610'`,\n", "which represents the districts of the upper house of the legeslature of a state. The value\n", "associated with that key is a list of the keyword arguments we can pass to `censusdis.data.download`\n", "to specifiy what state and what district or disctricts within the state we want data for.\n", "\n", "This call will load data for all the variablles at the leaves of the dataset we examined earlier for\n", "all state senate districts in NJ by using the keyword arguments \n", "`state=STATE_NJ` and `state_legislative_district_upper_chamber=\"*\"`." ] }, { "cell_type": "code", "execution_count": 8, "id": "03f1115d-ca1d-45a9-9d9d-c9c6877ca7ca", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
STATESTATE_LEGISLATIVE_DISTRICT_UPPER_CHAMBERB03002_003EB03002_004EB03002_005EB03002_006EB03002_007EB03002_008EB03002_010EB03002_011EB03002_013EB03002_014EB03002_015EB03002_016EB03002_017EB03002_018EB03002_020EB03002_021EGEO_IDNAME
0340011421962161892519636371487496524460182019110725996929431306610U600US34001State Senate District 1 (2018), New Jersey
1340021078673177054717962986506945588165321398694128161830148931337610U600US34002State Senate District 2 (2018), New Jersey
23400314967833696452426424237358432715417931179222268803862590610U600US34003State Senate District 3 (2018), New Jersey
33400414829239088216703217507411572388852564287410588612021466610U600US34004State Senate District 4 (2018), New Jersey
4340051149964266020672251869014237831654324552396424245895088963610U600US34005State Senate District 5 (2018), New Jersey
53400614474722647138218296314475704509119361762924071990125831188610U600US34006State Senate District 6 (2018), New Jersey
63400713461247217521210850871561728891591511332207445962102948610U600US34007State Senate District 7 (2018), New Jersey
734008160610228233578781133885616264829115281704913441742510984610U600US34008State Senate District 8 (2018), New Jersey
83400919416275861175480464181964949112739281264033281989183610U600US34009State Senate District 9 (2018), New Jersey
9340101889827378188576513698620941301192565311434044832396689610U600US34010State Senate District 10 (2018), New Jersey
103401113955929607133784911776599465418109177429746151026633851317610U600US34011State Senate District 11 (2018), New Jersey
1134012161981148251721791903215433885163801193141136041293543428610U600US34012State Senate District 12 (2018), New Jersey
12340131767975123115179257143376231961086620715466922561645505610U600US34013State Senate District 13 (2018), New Jersey
1334014129659184822223710163284591333520948105028167749782207849610U600US34014State Senate District 14 (2018), New Jersey
14340158858655027407236612916127836452344922885253516496884578468610U600US34015State Senate District 15 (2018), New Jersey
153401613827511402512488742910491224444912458581168514632622454458610U600US34016State Senate District 16 (2018), New Jersey
1634017708564529535352596241699114437913162922694741296136132775602610U600US34017State Senate District 17 (2018), New Jersey
1734018969061638914469965198112517694270135197161071399792632351546610U600US34018State Senate District 18 (2018), New Jersey
18340198217221725234373329110058362655526583034493348421520174702693610U600US34019State Senate District 19 (2018), New Jersey
1934020434166410212490203262461034258139353307889427805064784361632610U600US34020State Senate District 20 (2018), New Jersey
20340211570297157130238224209217841021366476427252966673113745610U600US34021State Senate District 21 (2018), New Jersey
213402285166481103021088001933526326630431280275182532764369861867610U600US34022State Senate District 22 (2018), New Jersey
223402315809085891371745067547823297514501537762271052693280900610U600US34023State Senate District 23 (2018), New Jersey
23340241722615102545774036655031451374450933381821852191778610U600US34024State Senate District 24 (2018), New Jersey
24340251496128463951299805204354235232515613983343877833541009610U600US34025State Senate District 25 (2018), New Jersey
253402615899939803122993368560710377915035276187124020511752515610U600US34026State Senate District 26 (2018), New Jersey
263402713541127575149276374719036005410139741106117711043683807949610U600US34027State Senate District 27 (2018), New Jersey
2734028482621249434189828013611550335419526294114414361120834332255610U600US34028State Senate District 28 (2018), New Jersey
283402939357697405186621133346177524775116943224441407835428114472838610U600US34029State Senate District 29 (2018), New Jersey
29340301982485260794598036156012291356049816319071692567499610U600US34030State Senate District 30 (2018), New Jersey
30340316115354849533483506817491560495826783400042657502335566152378610U600US34031State Senate District 31 (2018), New Jersey
31340326114961352352569601031920249273439262011827313842161142613065610U600US34032State Senate District 32 (2018), New Jersey
323403379083101642643623128099488642725352443587443661321507108982940610U600US34033State Senate District 33 (2018), New Jersey
33340346230786049245112972214081534353423737253124473862007648771035610U600US34034State Senate District 34 (2018), New Jersey
34340354858041180609525899441820144597424162561163554886107412598610U600US34035State Senate District 35 (2018), New Jersey
353403696442858329324153907795912463598631956538391615771147271889610U600US34036State Senate District 36 (2018), New Jersey
3634037836352816228555617449491060396432260236828916923833142993252610U600US34037State Senate District 37 (2018), New Jersey
373403812593797723423393443578467317529169115126125412589059181866610U600US34038State Senate District 38 (2018), New Jersey
38340391593774062328262300550971365517047730100278024992966954610U600US34039State Senate District 39 (2018), New Jersey
39340401643604799219172461295084283114168993612772030393884604610U600US34040State Senate District 40 (2018), New Jersey
\n", "
" ], "text/plain": [ " STATE STATE_LEGISLATIVE_DISTRICT_UPPER_CHAMBER B03002_003E B03002_004E \\\n", "0 34 001 142196 21618 \n", "1 34 002 107867 31770 \n", "2 34 003 149678 33696 \n", "3 34 004 148292 39088 \n", "4 34 005 114996 42660 \n", "5 34 006 144747 22647 \n", "6 34 007 134612 47217 \n", "7 34 008 160610 22823 \n", "8 34 009 194162 7586 \n", "9 34 010 188982 7378 \n", "10 34 011 139559 29607 \n", "11 34 012 161981 14825 \n", "12 34 013 176797 5123 \n", "13 34 014 129659 18482 \n", "14 34 015 88586 55027 \n", "15 34 016 138275 11402 \n", "16 34 017 70856 45295 \n", "17 34 018 96906 16389 \n", "18 34 019 82172 21725 \n", "19 34 020 43416 64102 \n", "20 34 021 157029 7157 \n", "21 34 022 85166 48110 \n", "22 34 023 158090 8589 \n", "23 34 024 172261 5102 \n", "24 34 025 149612 8463 \n", "25 34 026 158999 3980 \n", "26 34 027 135411 27575 \n", "27 34 028 48262 124943 \n", "28 34 029 39357 69740 \n", "29 34 030 198248 5260 \n", "30 34 031 61153 54849 \n", "31 34 032 61149 6135 \n", "32 34 033 79083 10164 \n", "33 34 034 62307 86049 \n", "34 34 035 48580 41180 \n", "35 34 036 96442 8583 \n", "36 34 037 83635 28162 \n", "37 34 038 125937 9772 \n", "38 34 039 159377 4062 \n", "39 34 040 164360 4799 \n", "\n", " B03002_005E B03002_006E B03002_007E B03002_008E B03002_010E \\\n", "0 925 1963 6 371 487 \n", "1 547 17962 98 650 694 \n", "2 452 4264 24 237 358 \n", "3 216 7032 17 507 411 \n", "4 206 7225 18 690 142 \n", "5 138 21829 63 1447 570 \n", "6 52 12108 50 871 561 \n", "7 35 7878 113 388 561 \n", "8 117 5480 46 418 196 \n", "9 188 5765 136 986 209 \n", "10 133 7849 11 776 599 \n", "11 172 17919 0 321 543 \n", "12 115 17925 71 433 762 \n", "13 222 37101 63 284 591 \n", "14 407 23661 29 161 278 \n", "15 512 48874 29 1049 1224 \n", "16 353 52596 24 1699 1144 \n", "17 144 69965 198 1125 1769 \n", "18 234 37332 91 1005 836 \n", "19 124 9020 32 6246 1034 \n", "20 130 23822 4 2092 178 \n", "21 302 10880 0 1933 526 \n", "22 137 17450 67 547 823 \n", "23 54 5774 0 366 550 \n", "24 95 12998 0 520 435 \n", "25 312 29933 68 560 710 \n", "26 149 27637 47 1903 600 \n", "27 418 9828 0 1361 1550 \n", "28 518 6621 133 3461 775 \n", "29 79 4598 0 361 560 \n", "30 533 48350 68 1749 1560 \n", "31 235 25696 0 1031 920 \n", "32 264 36231 280 994 886 \n", "33 245 11297 22 1408 1534 \n", "34 60 9525 8 994 418 \n", "35 293 24153 90 779 591 \n", "36 285 55617 44 949 1060 \n", "37 342 33934 43 578 467 \n", "38 328 26230 0 550 971 \n", "39 219 17246 129 508 428 \n", "\n", " B03002_011E B03002_013E B03002_014E B03002_015E B03002_016E \\\n", "0 4965 24460 1820 191 107 \n", "1 5588 16532 1398 694 128 \n", "2 4327 15417 931 179 22 \n", "3 5723 8885 2564 287 41 \n", "4 3783 16543 2455 239 64 \n", "5 4509 11936 1762 92 40 \n", "6 7288 9159 1511 332 207 \n", "7 6264 8291 1528 170 49 \n", "8 4949 11273 928 12 64 \n", "9 4130 11925 653 114 34 \n", "10 4654 18109 1774 297 46 \n", "11 3885 16380 1193 141 136 \n", "12 3196 10866 207 154 66 \n", "13 3335 20948 1050 28 167 \n", "14 3645 23449 2288 525 35 \n", "15 4449 12458 581 168 51 \n", "16 3791 31629 2269 474 129 \n", "17 4270 13519 716 107 139 \n", "18 2655 52658 3034 493 348 \n", "19 2581 39353 3078 894 278 \n", "20 4102 13664 764 27 252 \n", "21 3266 30431 2802 751 82 \n", "22 2975 14501 537 76 227 \n", "23 3145 13744 509 33 38 \n", "24 4235 23251 561 398 33 \n", "25 3779 15035 276 187 124 \n", "26 5410 13974 1106 117 71 \n", "27 3354 19526 2941 144 143 \n", "28 2477 51169 4322 444 140 \n", "29 1229 13560 498 163 19 \n", "30 4958 26783 4000 426 575 \n", "31 2492 73439 2620 1182 731 \n", "32 4272 53524 4358 744 366 \n", "33 3534 23737 2531 244 73 \n", "34 2014 45974 2416 256 116 \n", "35 2463 59863 1956 538 391 \n", "36 3964 32260 2368 289 169 \n", "37 3175 29169 1151 261 254 \n", "38 3655 17047 730 100 278 \n", "39 3114 16899 361 27 72 \n", "\n", " B03002_017E B03002_018E B03002_020E B03002_021E GEO_ID \\\n", "0 25 9969 2943 1306 610U600US34001 \n", "1 16 18301 4893 1337 610U600US34002 \n", "2 22 6880 3862 590 610U600US34003 \n", "3 0 5886 1202 1466 610U600US34004 \n", "4 24 24589 5088 963 610U600US34005 \n", "5 71 9901 2583 1188 610U600US34006 \n", "6 4 4596 2102 948 610U600US34007 \n", "7 134 4174 2510 984 610U600US34008 \n", "8 0 3328 1989 183 610U600US34009 \n", "9 0 4483 2396 689 610U600US34010 \n", "10 15 10266 3385 1317 610U600US34011 \n", "11 0 4129 3543 428 610U600US34012 \n", "12 9 2256 1645 505 610U600US34013 \n", "13 7 4978 2207 849 610U600US34014 \n", "14 164 9688 4578 468 610U600US34015 \n", "15 46 3262 2454 458 610U600US34016 \n", "16 6 13613 2775 602 610U600US34017 \n", "17 9 7926 3235 1546 610U600US34018 \n", "18 42 15201 7470 2693 610U600US34019 \n", "19 0 50647 8436 1632 610U600US34020 \n", "20 9 6667 3113 745 610U600US34021 \n", "21 53 27643 6986 1867 610U600US34022 \n", "22 10 5269 3280 900 610U600US34023 \n", "23 18 2185 2191 778 610U600US34024 \n", "24 43 8778 3354 1009 610U600US34025 \n", "25 0 2051 1752 515 610U600US34026 \n", "26 10 4368 3807 949 610U600US34027 \n", "27 6 11208 3433 2255 610U600US34028 \n", "28 78 35428 11447 2838 610U600US34029 \n", "29 0 7169 2567 499 610U600US34030 \n", "30 0 23355 6615 2378 610U600US34031 \n", "31 38 42161 14261 3065 610U600US34032 \n", "32 13 21507 10898 2940 610U600US34033 \n", "33 86 20076 4877 1035 610U600US34034 \n", "34 35 54886 10741 2598 610U600US34035 \n", "35 6 15771 14727 1889 610U600US34036 \n", "36 23 8331 4299 3252 610U600US34037 \n", "37 12 5890 5918 1866 610U600US34038 \n", "38 0 2499 2966 954 610U600US34039 \n", "39 0 3039 3884 604 610U600US34040 \n", "\n", " NAME \n", "0 State Senate District 1 (2018), New Jersey \n", "1 State Senate District 2 (2018), New Jersey \n", "2 State Senate District 3 (2018), New Jersey \n", "3 State Senate District 4 (2018), New Jersey \n", "4 State Senate District 5 (2018), New Jersey \n", "5 State Senate District 6 (2018), New Jersey \n", "6 State Senate District 7 (2018), New Jersey \n", "7 State Senate District 8 (2018), New Jersey \n", "8 State Senate District 9 (2018), New Jersey \n", "9 State Senate District 10 (2018), New Jersey \n", "10 State Senate District 11 (2018), New Jersey \n", "11 State Senate District 12 (2018), New Jersey \n", "12 State Senate District 13 (2018), New Jersey \n", "13 State Senate District 14 (2018), New Jersey \n", "14 State Senate District 15 (2018), New Jersey \n", "15 State Senate District 16 (2018), New Jersey \n", "16 State Senate District 17 (2018), New Jersey \n", "17 State Senate District 18 (2018), New Jersey \n", "18 State Senate District 19 (2018), New Jersey \n", "19 State Senate District 20 (2018), New Jersey \n", "20 State Senate District 21 (2018), New Jersey \n", "21 State Senate District 22 (2018), New Jersey \n", "22 State Senate District 23 (2018), New Jersey \n", "23 State Senate District 24 (2018), New Jersey \n", "24 State Senate District 25 (2018), New Jersey \n", "25 State Senate District 26 (2018), New Jersey \n", "26 State Senate District 27 (2018), New Jersey \n", "27 State Senate District 28 (2018), New Jersey \n", "28 State Senate District 29 (2018), New Jersey \n", "29 State Senate District 30 (2018), New Jersey \n", "30 State Senate District 31 (2018), New Jersey \n", "31 State Senate District 32 (2018), New Jersey \n", "32 State Senate District 33 (2018), New Jersey \n", "33 State Senate District 34 (2018), New Jersey \n", "34 State Senate District 35 (2018), New Jersey \n", "35 State Senate District 36 (2018), New Jersey \n", "36 State Senate District 37 (2018), New Jersey \n", "37 State Senate District 38 (2018), New Jersey \n", "38 State Senate District 39 (2018), New Jersey \n", "39 State Senate District 40 (2018), New Jersey " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ced.download(\n", " DATASET, YEAR, leaves, state=STATE_NJ, state_legislative_district_upper_chamber=\"*\"\n", ")" ] }, { "cell_type": "markdown", "id": "41349f4e-6501-48a4-82dc-ceb9dab04804", "metadata": {}, "source": [ "## Error Handling\n", "\n", "What happens if we get one of the keywords wrong? We can always look \n", "a few cells up at the output from `cgeo.geo_path_snake_specs`, but we\n", "also get a friendly exception message to tell us what the options are." ] }, { "cell_type": "code", "execution_count": 9, "id": "b02afc25-2ea8-4f72-9725-4276ed7bb603", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The following args are not recognized as non-geographic arguments or goegraphic arguments for the dataset acs/acs5 in vintage 2020: unknown_geo.\n", "Sometimes this can be due to spelling errors in argument names.\n", "Supported geographies for dataset='acs/acs5' in year=2020 are:\n", "['us']\n", "['region']\n", "['division']\n", "['state']\n", "['state', 'county']\n", "['state', 'county', 'county_subdivision']\n", "['state', 'county', 'county_subdivision', 'subminor_civil_division']\n", "['state', 'county', 'county_subdivision', 'place_remainder_or_part']\n", "['state', 'county', 'tract']\n", "['state', 'county', 'tract', 'block_group']\n", "['state', 'place', 'county_or_part']\n", "['state', 'place']\n", "['state', 'consolidated_city']\n", "['state', 'consolidated_city', 'place_or_part']\n", "['state', 'alaska_native_regional_corporation']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'tribal_subdivision_remainder']\n", "['american_indian_area_alaska_native_area_reservation_or_statistical_entity_only']\n", "['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'tribal_census_tract']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'tribal_census_tract', 'tribal_block_group']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'state_or_part']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'state_or_part', 'place_remainder_or_part']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'state_or_part', 'county_or_part']\n", "['state', 'american_indian_area_alaska_native_area_hawaiian_home_land_or_part']\n", "['state', 'american_indian_area_alaska_native_area_reservation_or_statistical_entity_only_or_part']\n", "['state', 'american_indian_area_off_reservation_trust_land_only_hawaiian_home_land_or_part']\n", "['american_indian_area_alaska_native_area_hawaiian_home_land', 'tribal_subdivision_remainder', 'state_or_part']\n", "['american_indian_area_reservation_only', 'tribal_census_tract_or_part']\n", "['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land', 'tribal_census_tract_or_part']\n", "['american_indian_area_reservation_only', 'tribal_census_tract_or_part', 'tribal_block_group_or_part']\n", "['american_indian_area_off_reservation_trust_land_only_hawaiian_home_land', 'tribal_census_tract_or_part', 'tribal_block_group_or_part']\n", "['metropolitan_statistical_area_micropolitan_statistical_area']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'state_or_part']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'state_or_part', 'principal_city_or_part']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'state_or_part', 'county']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'metropolitan_division']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'metropolitan_division', 'state_or_part']\n", "['metropolitan_statistical_area_micropolitan_statistical_area', 'metropolitan_division', 'state_or_part', 'county']\n", "['state', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part']\n", "['state', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part', 'principal_city_or_part']\n", "['state', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part', 'county']\n", "['state', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part', 'metropolitan_division_or_part']\n", "['state', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part', 'metropolitan_division_or_part', 'county']\n", "['combined_statistical_area']\n", "['combined_statistical_area', 'state_or_part']\n", "['combined_statistical_area', 'metropolitan_statistical_area_micropolitan_statistical_area']\n", "['combined_statistical_area', 'metropolitan_statistical_area_micropolitan_statistical_area', 'state_or_part']\n", "['combined_new_england_city_and_town_area']\n", "['combined_new_england_city_and_town_area', 'state_or_part']\n", "['combined_new_england_city_and_town_area', 'new_england_city_and_town_area']\n", "['combined_new_england_city_and_town_area', 'new_england_city_and_town_area', 'state_or_part']\n", "['state', 'combined_statistical_area_or_part']\n", "['state', 'combined_statistical_area_or_part', 'metropolitan_statistical_area_micropolitan_statistical_area_or_part']\n", "['state', 'combined_new_england_city_and_town_area_or_part']\n", "['state', 'combined_new_england_city_and_town_area_or_part', 'new_england_city_and_town_area_or_part']\n", "['new_england_city_and_town_area']\n", "['new_england_city_and_town_area', 'state_or_part']\n", "['new_england_city_and_town_area', 'state_or_part', 'principal_city']\n", "['new_england_city_and_town_area', 'state_or_part', 'county_or_part']\n", "['new_england_city_and_town_area', 'state_or_part', 'county_or_part', 'county_subdivision']\n", "['new_england_city_and_town_area', 'necta_division']\n", "['new_england_city_and_town_area', 'necta_division', 'state_or_part']\n", "['new_england_city_and_town_area', 'necta_division', 'state_or_part', 'county_or_part']\n", "['new_england_city_and_town_area', 'necta_division', 'state_or_part', 'county_or_part', 'county_subdivision']\n", "['state', 'new_england_city_and_town_area_or_part']\n", "['state', 'new_england_city_and_town_area_or_part', 'principal_city']\n", "['state', 'new_england_city_and_town_area_or_part', 'county_or_part']\n", "['state', 'new_england_city_and_town_area_or_part', 'county_or_part', 'county_subdivision']\n", "['state', 'new_england_city_and_town_area_or_part', 'necta_division_or_part']\n", "['state', 'new_england_city_and_town_area_or_part', 'necta_division_or_part', 'county_or_part']\n", "['state', 'new_england_city_and_town_area_or_part', 'necta_division_or_part', 'county_or_part', 'county_subdivision']\n", "['urban_area']\n", "['urban_area', 'state']\n", "['urban_area', 'state', 'county']\n", "['state', 'congressional_district']\n", "['state', 'congressional_district', 'county_or_part']\n", "['state', 'congressional_district', 'american_indian_area_alaska_native_area_hawaiian_home_land_or_part']\n", "['state', 'state_legislative_district_upper_chamber']\n", "['state', 'state_legislative_district_upper_chamber', 'county_or_part']\n", "['state', 'state_legislative_district_lower_chamber']\n", "['state', 'state_legislative_district_lower_chamber', 'county_or_part']\n", "['state', 'public_use_microdata_area']\n", "['zip_code_tabulation_area']\n", "['state', 'school_district_elementary']\n", "['state', 'school_district_secondary']\n", "['state', 'school_district_unified']\n" ] } ], "source": [ "try:\n", " ced.download(DATASET, YEAR, leaves, state=STATE_NJ, unknown_geo=\"*\")\n", "except ced.CensusApiException as e:\n", " print(e)" ] }, { "cell_type": "code", "execution_count": null, "id": "e5d7322b-f7b8-409d-be01-9a3514689e58", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.4" } }, "nbformat": 4, "nbformat_minor": 5 }